home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / PCHDT_E3.CAB / rcBuddy.cab / RAControl.js < prev    next >
Encoding:
Text File  |  2003-03-24  |  14.5 KB  |  548 lines

  1. var L_RELEASECONTROL_Text = "  Release <U>C</U>ontrol";
  2. var L_HELPEEREJECTRC_Text = "Your request to take control of remote computer was rejected by ";
  3. var L_HELPEETAKECONTROL_Text = " has stopped control.";
  4. var L_CONTROL1_Text = "You now are sharing control of ";
  5. var L_CONTROL2_Text = "'s computer. Click in ";
  6. var L_CONTROL3_Text = "'s screen to get started.\n\nControl will return to ";
  7. var L_CONTROL4_Text = " if you press the ESC key, or any key sequence or combination including the ESC key (such as ESC+TAB)";
  8. var L_ERRRCPERMDENIED1_Text = "Control of remote computer is not allowed.";
  9. var L_ERRRCERROR_Text = "Request to take control of remote computer failed.";
  10. var L_ERRVOIP1_Text = "A voice connection could not be established. Please try again later.";;
  11. var L_ERRVOIP2_Text = "The necessary hardware and/or configuration to use a voice connection is not available;'Start Talking' will be disabled for the remainder of this Remote Assistance session.";
  12. function Helper_SetupControlChannel()
  13. {
  14. ;
  15. try
  16. {
  17. ;
  18. if(null == g_oSAFRemoteAssistanceHelper.m_oSAFRemoteDesktopChannelMgr)
  19. {
  20. g_oSAFRemoteAssistanceHelper.m_oSAFRemoteDesktopChannelMgr = g_oSAFRemoteAssistanceHelper.m_oSAFRemoteDesktopClient.ChannelManager;
  21. }
  22. ;
  23. g_oSAFRemoteAssistanceHelper.m_oControlChannel = g_oSAFRemoteAssistanceHelper.m_oSAFRemoteDesktopChannelMgr.OpenDataChannel( "71" );
  24. var ip;
  25. var oSetting = new ActiveXObject("rcbdyctl.setting");
  26. ip = oSetting.GetIPAddress;
  27. Helper_SendIPAddress(ip);
  28. g_oSAFRemoteAssistanceHelper.m_oControlChannel.OnChannelDataReady = function()
  29. { Helper_ControlChannelDataReadyHandler(); }
  30. }
  31. catch(error)
  32. {
  33. FatalError( L_ERRFATAL_Text, error );
  34. }
  35. ;
  36. return;
  37. }
  38. function Helper_ControlChannelDataReadyHandler()
  39. {
  40. ;
  41. var ControlData = null;
  42. try
  43. {
  44. ControlData = g_oSAFRemoteAssistanceHelper.m_oControlChannel.ReceiveChannelData();
  45. }
  46. catch(error)
  47. {
  48. FatalError(L_ERRFATAL_Text, error);
  49. }
  50. SoundBeep();
  51. Helper_ParseControlData ( ControlData );
  52. ;
  53. return;
  54. }
  55. function Helper_ParseControlData ( ControlData )
  56. {
  57. ;
  58. var Doc = new ActiveXObject("microsoft.XMLDOM");
  59. var RCCommand = null;
  60. var szCommandName = null;
  61. try
  62. {
  63. if( false == Doc.loadXML( ControlData ))
  64. {
  65. FatalError ( Doc.parseError.reason );
  66. }
  67. RCCommand = Doc.documentElement;
  68. szCommandName = RCCommand.getAttribute( "NAME" );
  69. idCtx.minimized = false;
  70. idCtx.bringToForeground();
  71. if( szCommandName == "SCREENINFO" )
  72. {
  73. g_oSAFRemoteAssistanceHelper.m_UserWidth = RCCommand.getAttribute( "WIDTH" );
  74. g_oSAFRemoteAssistanceHelper.m_UserHeight = RCCommand.getAttribute( "HEIGHT" );
  75. g_oSAFRemoteAssistanceHelper.m_UserColorDepth = RCCommand.getAttribute( "COLORDEPTH" );
  76. if( true == false )
  77. {
  78. var szSchemaVersion = null;
  79. var szControlChannelVersion = null;
  80. try
  81. {
  82. szSchemaVersion = RCCommand.getAttribute( "SCHEMAVERSION" );
  83. if( szSchemaVersion != "5.1" )
  84. {
  85. alert(L_ERRSCHEMAVERSION_Text);
  86. }
  87. }
  88. catch(error)
  89. {
  90. alert(L_ERRSCHEMAVERSION_Text);
  91. }
  92. try
  93. {
  94. szControlChannelVersion = RCCommand.getAttribute( "CONTROLCHANNELVERSION" );
  95. if( szControlChannelVersion != "5.1" )
  96. {
  97. alert(L_ERRCHANNELVERSION_Text);
  98. }
  99. }
  100. catch(error)
  101. {
  102. alert(L_ERRSCHEMAVERSION_Text);
  103. }
  104. }
  105. Helper_SendVersionInfo();
  106. }
  107. else if( szCommandName == "DISCONNECTRC" )
  108. {
  109. g_oSAFRemoteAssistanceHelper.m_bUserDisconnect = true;
  110. RCDisconnect();
  111. }
  112. else if( szCommandName == "FILEXFER" )
  113. {
  114. var vArgs = new Array(13);
  115. vArgs[0] = 1;
  116. vArgs[1] = g_oSAFRemoteAssistanceHelper.m_oControlChannel;
  117. vArgs[2] = g_oSAFRemoteAssistanceHelper.m_oSAFRemoteDesktopChannelMgr;
  118. vArgs[3] = RCCommand.getAttribute( "FILENAME" );
  119. vArgs[4] = RCCommand.getAttribute( "FILESIZE" );
  120. vArgs[5] = RCCommand.getAttribute( "CHANNELID" );
  121. vArgs[6] = g_oSAFRemoteAssistanceHelper.m_oFso;
  122. vArgs[7] = g_oSAFRemoteAssistanceHelper.m_oRCFileDlg;
  123. vArgs[8] = g_oSAFRemoteAssistanceHelper.m_oSAFClassFactory;
  124. vArgs[9] = g_oSAFRemoteAssistanceHelper.m_szUserName;
  125. vArgs[10] = new ActiveXObject("RACplDlg.RAEventLog");
  126. vArgs[11] = g_oSAFRemoteAssistanceHelper.m_szHelpeeIP;
  127. vArgs[12] = g_oSAFRemoteAssistanceHelper.m_szLocalUser;
  128. var subWin = window.showModelessDialog( "hcp://system/Remote Assistance/Interaction/Common/RCFileXfer.htm", vArgs, "dialogwidth:" + "405" + "px;dialogHeight:" + "179" + "px;status:no;resizable:no;help:no");
  129. AddOpenSubWin( subWin );
  130. }
  131. else if (szCommandName == "ACCEPTRC")
  132. {
  133. parent.frames.idFrameTools.idTB.SetVisibility( "btnTakeControl", false);
  134. parent.frames.idFrameTools.idTB.SetVisibility( "btnReleaseControl", true);
  135. try
  136. {
  137. var oLogger = new ActiveXObject("RACplDlg.RAEventLog");
  138. var args = new Array(2);
  139. args[0] = g_oSAFRemoteAssistanceHelper.m_szLocalUser;
  140. args[1] = g_oSAFRemoteAssistanceHelper.m_szUserName;
  141. oLogger.LogRemoteAssistanceEvent(0,5,args);
  142. }
  143. catch(e)
  144. {
  145. }
  146. parent.frames.idFrameStatus.Helper_UpdateStatus( L_INCONTROL_Text );
  147. var vArgs = new Array(1);
  148. vArgs[0] = L_CONTROL1_Text + g_oSAFRemoteAssistanceHelper.m_szUserName + L_CONTROL2_Text + g_oSAFRemoteAssistanceHelper.m_szUserName + L_CONTROL3_Text + g_oSAFRemoteAssistanceHelper.m_szUserName + L_CONTROL4_Text;
  149. var vRetVal = window.showModelessDialog( "hcp://system/Remote Assistance/Interaction/Common/ErrorMsgs.htm", vArgs, "dialogwidth:470px;dialogHeight:188px;status:no;resizable:no;help:no" );
  150. AddOpenSubWin( vRetVal );
  151. g_oSAFRemoteAssistanceHelper.m_bRCEnabled = true;
  152. }
  153. else if (szCommandName == "REJECTRC")
  154. {
  155. var vArgs = new Array(1);
  156. vArgs[0] = L_HELPEEREJECTRC_Text + " " + g_oSAFRemoteAssistanceHelper.m_szUserName;
  157. parent.frames.idFrameTools.idTB.SetState( "btnTakeControl", true );
  158. parent.frames.idFrameTools.g_bTakeControlDisabled = false;
  159. parent.frames.idFrameStatus.Helper_UpdateStatus( L_SCREENVIEWONLY_Text );
  160. var vRetVal = window.showModelessDialog( "hcp://system/Remote Assistance/Interaction/Common/ErrorMsgs.htm", vArgs, "dialogwidth:405px;dialogHeight:165px;status:no;resizable:no;help:no" );
  161. AddOpenSubWin( vRetVal );
  162. }
  163. else if (szCommandName == "TAKECONTROL")
  164. {
  165. try
  166. {
  167. var oLogger = new ActiveXObject("RACplDlg.RAEventLog");
  168. var args = new Array(2);
  169. args[0] = g_oSAFRemoteAssistanceHelper.m_szLocalUser;
  170. args[1] = g_oSAFRemoteAssistanceHelper.m_szUserName;
  171. oLogger.LogRemoteAssistanceEvent(0,6,args);
  172. }
  173. catch(e)
  174. {
  175. }
  176. var vArgs = new Array(1);
  177. vArgs[0] = g_oSAFRemoteAssistanceHelper.m_szUserName + L_HELPEETAKECONTROL_Text;
  178. parent.frames.idFrameTools.idTB.SetVisibility( "btnReleaseControl", false);
  179. parent.frames.idFrameTools.idTB.SetVisibility( "btnTakeControl", true);
  180. parent.frames.idFrameTools.idTB.SetState( "btnTakeControl", true );
  181. parent.frames.idFrameTools.g_bTakeControlDisabled = false;
  182. g_oSAFRemoteAssistanceHelper.m_bRCEnabled = false;
  183. parent.frames.idFrameStatus.Helper_UpdateStatus( L_SCREENVIEWONLY_Text );
  184. var vRetVal = window.showModelessDialog( "hcp://system/Remote Assistance/Interaction/Common/ErrorMsgs.htm", vArgs, "dialogwidth:405px;dialogHeight:165px;status:no;resizable:no;help:no" );
  185. AddOpenSubWin( vRetVal );
  186. }
  187. else if (szCommandName == "ESCRC")
  188. {
  189. try
  190. {
  191. var oLogger = new ActiveXObject("RACplDlg.RAEventLog");
  192. var args = new Array(2);
  193. args[0] = g_oSAFRemoteAssistanceHelper.m_szLocalUser;
  194. args[1] = g_oSAFRemoteAssistanceHelper.m_szUserName;
  195. oLogger.LogRemoteAssistanceEvent(0,6,args);
  196. }
  197. catch(e)
  198. {
  199. }
  200. var vArgs = new Array(1);
  201. vArgs[0] = g_oSAFRemoteAssistanceHelper.m_szUserName + L_OR_Text + g_oSAFRemoteAssistanceHelper.m_szLocalUser + L_ESCHIT_Text;
  202. parent.frames.idFrameTools.idTB.SetVisibility( "btnReleaseControl", false);
  203. parent.frames.idFrameTools.idTB.SetVisibility( "btnTakeControl", true);
  204. parent.frames.idFrameTools.idTB.SetState( "btnTakeControl", true );
  205. parent.frames.idFrameTools.g_bTakeControlDisabled = false;
  206. g_oSAFRemoteAssistanceHelper.m_bRCEnabled = false;
  207. parent.frames.idFrameStatus.Helper_UpdateStatus( L_SCREENVIEWONLY_Text );
  208. var vRetVal = window.showModelessDialog( "hcp://system/Remote Assistance/Interaction/Common/ErrorMsgs.htm", vArgs, "dialogwidth:405px;dialogHeight:165px;status:no;resizable:no;help:no" );
  209. AddOpenSubWin( vRetVal );
  210. }
  211. else if ( szCommandName == "DENIEDRC" )
  212. {
  213. var vArgs = new Array(1);
  214. vArgs[0] = L_ERRRCPERMDENIED1_Text;
  215. parent.frames.idFrameTools.idTB.SetState( "btnTakeControl", true );
  216. parent.frames.idFrameTools.g_bTakeControlDisabled = false;
  217. parent.frames.idFrameStatus.Helper_UpdateStatus( L_SCREENVIEWONLY_Text );
  218. var vRetVal = window.showModalDialog( "hcp://system/Remote Assistance/Interaction/Common/ErrorMsgs.htm", vArgs, "dialogwidth:405px;dialogHeight:165px;status:no;resizable:no;help:no" );
  219. }
  220. else if ( szCommandName == "ERRORRC" )
  221. {
  222. var vArgs = new Array(1);
  223. vArgs[0] = L_ERRRCERROR_Text;
  224. parent.frames.idFrameTools.idTB.SetState( "btnTakeControl", true );
  225. parent.frames.idFrameStatus.Helper_UpdateStatus( L_SCREENVIEWONLY_Text );
  226. var vRetVal = window.showModelessDialog( "hcp://system/Remote Assistance/Interaction/Common/ErrorMsgs.htm", vArgs, "dialogwidth:405px;dialogHeight:165px;status:no;resizable:no;help:no" );
  227. }
  228. else if (szCommandName == "PRESTARTYES")
  229. {
  230. if (false == g_bVoIPEnabled)
  231. {
  232. return;
  233. }
  234. if (false == g_bVoipConnected)
  235. {
  236. try
  237. {
  238. Helper_SendControlCommand ( "VOIPPREGO" );
  239. }
  240. catch (e)
  241. {
  242. }
  243. }
  244. else
  245. {
  246. try
  247. {
  248. g_oSAFRemoteAssistanceHelper.m_oSAFIntercomClient.Disconnect();
  249. }
  250. catch (e)
  251. {
  252. frames.idFrameTools.idTB.SetState( "btnVoice", true );
  253. g_bStartEnabled = true;
  254. }
  255. }
  256. }
  257. else if (szCommandName == "VOIPPREGO")
  258. {
  259. if (false == g_bVoIPEnabled)
  260. {
  261. return;
  262. }
  263. try
  264. {
  265. var vArgs = new Array(1);
  266. vArgs[0] = L_VOIPSTART_Text;
  267. var vRetVal = window.showModalDialog( "hcp://system/Remote Assistance/Interaction/Common/VOIPMsgs.htm", vArgs, "dialogwidth:405px;dialogHeight:165px;status:no;resizable:no;help:no" );
  268. if( 0 == vRetVal)
  269. {
  270. try
  271. {
  272. Helper_SendControlCommand( "VOIPPREGO2" );
  273. }
  274. catch (e)
  275. {
  276. }
  277. }
  278. else
  279. {
  280. Helper_SendControlCommand( "VOIPQNO" );
  281. frames.idFrameTools.idTB.SetState( "btnVoice", true );
  282. g_bStartEnabled = true;
  283. }
  284. }
  285. catch (error)
  286. {
  287. FatalError( L_RCCTL_Text, error );
  288. }
  289. }
  290. else if (szCommandName == "VOIPQNO")
  291. {
  292. if (false == g_bVoIPEnabled)
  293. {
  294. return;
  295. }
  296. try
  297. {
  298. DisplayMessage( L_ERRVOIP1_Text );
  299. frames.idFrameTools.idTB.SetState( "btnVoice", true );
  300. g_bStartEnabled = true;
  301. }
  302. catch (error)
  303. {
  304. FatalError( L_RCCTL_Text, error );
  305. }
  306. }
  307. else if (szCommandName == "VOIPGONO")
  308. {
  309. if (false == g_bVoIPEnabled)
  310. {
  311. return;
  312. }
  313. try
  314. {
  315. DisplayMessage( L_ERRVOIP1_Text );
  316. frames.idFrameTools.idTB.SetState( "btnVoice", true );
  317. g_bStartEnabled = true;
  318. }
  319. catch (error)
  320. {
  321. FatalError( L_RCCTL_Text, error );
  322. }
  323. }
  324. else if (szCommandName == "VOIPGO")
  325. {
  326. if (false == g_bVoIPEnabled)
  327. {
  328. return;
  329. }
  330. var szKey = null;
  331. var szIPPort = null;
  332. var szTemp = null;
  333. var szIP = null;
  334. var szRAIP = null;
  335. var i = 0;
  336. var j = 0;
  337. var bFoundIP = false;
  338. try
  339. {
  340. szKey = RCCommand.getAttribute( "VOIPGOKEY" );
  341. szTemp = RCCommand.getAttribute( "VOIPIPLIST" );
  342. while ((szTemp != null) && (i != -1) && (!bFoundIP))
  343. {
  344. i = szTemp.indexOf(";");
  345. if (i != -1)
  346. szIPPort = szTemp.slice(0,i);
  347. else
  348. szIPPort = szTemp;
  349. j = szIPPort.indexOf(":");
  350. if (j == -1)
  351. {
  352. szIP = szIPPort;
  353. }
  354. else
  355. szIP = szIPPort.slice(0,j);
  356. szRAIP = g_oSAFRemoteAssistanceHelper.m_szHelpeeIP;
  357. if (szIP == szRAIP)
  358. {
  359. bFoundIP = true;
  360. }
  361. if (i != -1)
  362. {
  363. szTemp = szTemp.slice(i+1);
  364. }
  365. }
  366. if (!bFoundIP)
  367. {
  368. szIPPort = g_oSAFRemoteAssistanceHelper.m_szHelpeeIP;
  369. }
  370. g_oSAFRemoteAssistanceHelper.m_oSAFIntercomClient.Connect(szIPPort, szKey);
  371. }
  372. catch (e)
  373. {
  374. frames.idFrameTools.Helper_onVoiceDisabled();
  375. }
  376. }
  377. else if (szCommandName == "PRESTARTNO")
  378. {
  379. if (false == g_bVoIPEnabled)
  380. {
  381. return;
  382. }
  383. try
  384. {
  385. g_bStartEnabled = true;
  386. frames.idFrameTools.idTB.SetState( "btnVoice", true );
  387. }
  388. catch (error)
  389. {
  390. FatalError( L_RCCTL_Text, error );
  391. }
  392. }
  393. else if (szCommandName == "PRESTART")
  394. {
  395. if (false == g_bVoIPEnabled)
  396. {
  397. return;
  398. }
  399. try
  400. {
  401. frames.idFrameTools.idTB.SetState( "btnVoice", false );
  402. if (false == g_bStartEnabled )
  403. {
  404. Helper_SendControlCommand ( "PRESTARTNO" );
  405. frames.idFrameTools.idTB.SetState( "btnVoice", true );
  406. }
  407. else
  408. {
  409. Helper_SendControlCommand ( "PRESTARTYES" );
  410. }
  411. }
  412. catch (error)
  413. {
  414. FatalError( L_RCCTL_Text, error );
  415. }
  416. }
  417. else if (szCommandName == "DISABLEVOICE")
  418. {
  419. try
  420. {
  421. if (g_bVoIPEnabled == true)
  422. {
  423. DisplayMessage( L_ERRVOIP2_Text );
  424. g_bVoIPEnabled = false;
  425. g_stateVoipYou = 2;
  426. frames.idFrameTools.idTB.SetState( "btnVoice", false );
  427. }
  428. }
  429. catch (error)
  430. {
  431. FatalError( L_RCCTL_Text, error );
  432. }
  433. }
  434. else if (szCommandName == "WIZARDGOOD")
  435. {
  436. try
  437. {
  438. g_stateVoipYou = 1;
  439. if ( (g_stateVoipYou < 2) && (g_stateVoipMe < 2) )
  440. {
  441. g_bVoIPEnabled = true;
  442. frames.idFrameTools.idTB.SetState( "btnVoice", true );
  443. }
  444. }
  445. catch (error)
  446. {
  447. FatalError( L_RCCTL_Text, error );
  448. }
  449. }
  450. else if (szCommandName == "WIZARDBAD")
  451. {
  452. try
  453. {
  454. g_bVoIPEnabled = false;
  455. DisplayMessage( L_ERRVOIP2_Text );
  456. g_stateVoipYou = 2;
  457. frames.idFrameTools.idTB.SetState( "btnVoice", false );
  458. }
  459. catch (error)
  460. {
  461. FatalError( L_RCCTL_Text, error );
  462. }
  463. }
  464. else if (szCommandName == "BANDWTOHIGH")
  465. {
  466. g_VoipBandwidth = 1;
  467. g_oSAFRemoteAssistanceHelper.m_oSAFIntercomClient.SamplingRate = 2;
  468. }
  469. else if (szCommandName == "BANDWTOLOW")
  470. {
  471. g_VoipBandwidth = 0;
  472. g_oSAFRemoteAssistanceHelper.m_oSAFIntercomClient.SamplingRate = 1;
  473. }
  474. }
  475. catch(error)
  476. {
  477. FatalError( L_ERRFATAL_Text, error );
  478. }
  479. ;
  480. return;
  481. }
  482. function Helper_SendVersionInfo()
  483. {
  484. ;
  485. var Doc = null;
  486. var RCCommand = null;
  487. try
  488. {
  489. Doc = new ActiveXObject("microsoft.XMLDOM");
  490. RCCommand = Doc.createElement( "RCCOMMAND" );
  491. RCCommand.setAttribute( "NAME", "HELPERVERSION" );
  492. RCCommand.setAttribute( "SCHEMAVERSION", "5.1" );
  493. RCCommand.setAttribute( "CONTROLCHANNELVERSION", "5.1" );
  494. g_oSAFRemoteAssistanceHelper.m_oControlChannel.SendChannelData( RCCommand.xml );
  495. }
  496. catch(error)
  497. {
  498. FatalError( L_RCCTL_Text, error );
  499. }
  500. ;
  501. }
  502. function Helper_SendControlCommand( szCommandName )
  503. {
  504. ;
  505. var Doc = null;
  506. var RCCommand = null;
  507. try
  508. {
  509. Doc = new ActiveXObject("microsoft.XMLDOM");
  510. RCCommand = Doc.createElement( "RCCOMMAND" );
  511. RCCommand.setAttribute( "NAME", szCommandName );
  512. g_oSAFRemoteAssistanceHelper.m_oControlChannel.SendChannelData( RCCommand.xml );
  513. }
  514. catch(error)
  515. {
  516. FatalError( L_RCCTL_Text, error );
  517. }
  518. ;
  519. return;
  520. }
  521. function Helper_SendIPAddress( szIP )
  522. {
  523. ;
  524. var Doc = null;
  525. var RCCommand = null;
  526. try
  527. {
  528. Doc = new ActiveXObject("microsoft.XMLDOM");
  529. RCCommand = Doc.createElement( "RCCOMMAND" );
  530. RCCommand.setAttribute( "NAME", "EXPERTIP" );
  531. RCCommand.setAttribute( "EXPERTIPDATA", szIP );
  532. g_oSAFRemoteAssistanceHelper.m_oControlChannel.SendChannelData( RCCommand.xml );
  533. }
  534. catch(error)
  535. {
  536. FatalError( L_RCCTL_Text, error );
  537. }
  538. ;
  539. return;
  540. }
  541. function Helper_ResetHelpee()
  542. {
  543. ;
  544. Helper_SendControlCommand( "REMOTECTRLEND" );
  545. ;
  546. return;
  547. }
  548.